#ifndef WEBVIEWUTILS_H
#define WEBVIEWUTILS_H

#include <QObject>

#include <QTcpServer>

class WebviewUtils : public QObject {
    Q_OBJECT

public:
    WebviewUtils(QObject *parent=0);
    Q_INVOKABLE QString readTextFile(QString path);

private:
    bool readSocketLine(QTcpSocket *socket, char *buf, int buffSz, int timeoutInMillis);
    QString base64_decode(char *string);

public slots:
    void newConnection();

signals:
    void requestReceived(QString req);

private:
    QTcpServer server;
};

#endif // WEBVIEWUTILS_H
